import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
    {
        path: "/",
        component: resolve => require(["@/views/Home.vue"], resolve)
    },
    {
        path: "/category",
        component: resolve => require(["@/views/category/Category.vue"], resolve)
    },
    {
        path: "/category/:categoryId",
        component: resolve => require(["@/views/category/Category.vue"], resolve)
    },
    {
        path: "/article",
        component: resolve => require(["@/views/article/Article.vue"], resolve)
    },
    {
        path: "/article/:articleId",
        component: resolve => require(["@/views/article/ArticleDetail.vue"], resolve)
    },
    {
        path: "/source",
        component: resolve => require(["@/views/source/Source.vue"], resolve)
    },
    {
        path: "/source/:sourceId",
        component: resolve => require(["@/views/source/SourceDetail.vue"], resolve)
    },
    {
        path: "/tool",
        component: resolve => require(["@/views/tool/Tool.vue"], resolve)
    },
    {
        path: "/tag",
        component: resolve => require(["@/views/tag/Tag.vue"], resolve)
    },
    {
        path: "/tag/:tagId",
        component: resolve => require(["@/components/home/home-article.vue"], resolve)
    },
    {
        path: "/timeAxis",
        component: resolve => require(["@/views/time/TimeAxis.vue"], resolve)
    },
    {
        path: "/friendChain",
        component: resolve => require(["@/views/friend/FriendChain.vue"], resolve)
    },
    {
        path: "/about",
        component: resolve => require(["@/views/about/About.vue"], resolve)
    },
    {
        path: "/user",
        component: resolve => require(["@/views/user/User.vue"], resolve),
        children: [
            {
                path: "/user/userInfo",
                component: resolve => require(["@/views/user/UserInfo.vue"], resolve)
            },
            {
                path: "/user/password",
                component: resolve => require(["@/views/user/Password.vue"], resolve)
            }
        ]
    }
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    linkActiveClass: "route-active",
    routes
});

export default router;
